.class Lcom/trademob/tracking/TMInstallId;
.super Ljava/lang/Object;
.source "TMInstallId.java"


# instance fields
.field private myInstallIDStatus:Ljava/lang/String;

.field private myInstallId:Ljava/lang/String;

.field private myUtilities:Lcom/trademob/tracking/TMUtility;


# direct methods
.method public constructor <init>(Lcom/trademob/tracking/TMUtility;)V
    .locals 4
    .parameter "aTMUtility"

    .prologue
    .line 21
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 23
    iput-object p1, p0, Lcom/trademob/tracking/TMInstallId;->myUtilities:Lcom/trademob/tracking/TMUtility;

    .line 25
    iget-object v1, p0, Lcom/trademob/tracking/TMInstallId;->myUtilities:Lcom/trademob/tracking/TMUtility;

    const-string v2, "TMInstallId"

    invoke-virtual {v1, v2}, Lcom/trademob/tracking/TMUtility;->isStored(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 27
    iget-object v1, p0, Lcom/trademob/tracking/TMInstallId;->myUtilities:Lcom/trademob/tracking/TMUtility;

    const-string v2, "TMInstallId"

    invoke-virtual {v1, v2}, Lcom/trademob/tracking/TMUtility;->restore(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    iput-object v1, p0, Lcom/trademob/tracking/TMInstallId;->myInstallId:Ljava/lang/String;

    .line 28
    const-string v1, "old"

    iput-object v1, p0, Lcom/trademob/tracking/TMInstallId;->myInstallIDStatus:Ljava/lang/String;

    .line 40
    :goto_0
    return-void

    .line 33
    :cond_0
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    .line 34
    .local v0, result:Ljava/lang/StringBuilder;
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v1

    invoke-virtual {v0, v1, v2}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    .line 35
    const/16 v1, 0x10

    invoke-virtual {p0, v1}, Lcom/trademob/tracking/TMInstallId;->getRandomSequence(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 36
    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    iput-object v1, p0, Lcom/trademob/tracking/TMInstallId;->myInstallId:Ljava/lang/String;

    .line 37
    const-string v1, "new"

    iput-object v1, p0, Lcom/trademob/tracking/TMInstallId;->myInstallIDStatus:Ljava/lang/String;

    .line 38
    iget-object v1, p0, Lcom/trademob/tracking/TMInstallId;->myUtilities:Lcom/trademob/tracking/TMUtility;

    const-string v2, "TMInstallId"

    iget-object v3, p0, Lcom/trademob/tracking/TMInstallId;->myInstallId:Ljava/lang/String;

    invoke-virtual {v1, v2, v3}, Lcom/trademob/tracking/TMUtility;->store(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0
.end method


# virtual methods
.method public final getInstallIsNew()Ljava/lang/String;
    .locals 2

    .prologue
    .line 49
    iget-object v0, p0, Lcom/trademob/tracking/TMInstallId;->myInstallIDStatus:Ljava/lang/String;

    const-string v1, "old"

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 51
    const-string v0, "old"

    .line 57
    :goto_0
    return-object v0

    .line 56
    :cond_0
    const-string v0, "old"

    iput-object v0, p0, Lcom/trademob/tracking/TMInstallId;->myInstallIDStatus:Ljava/lang/String;

    .line 57
    const-string v0, "new"

    goto :goto_0
.end method

.method public final getRandomSequence(I)Ljava/lang/String;
    .locals 5
    .parameter "length"

    .prologue
    .line 77
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    .line 78
    .local v2, result:Ljava/lang/StringBuilder;
    new-instance v1, Ljava/util/Random;

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v3

    invoke-direct {v1, v3, v4}, Ljava/util/Random;-><init>(J)V

    .line 79
    .local v1, rand:Ljava/util/Random;
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    if-lt v0, p1, :cond_0

    .line 83
    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    return-object v3

    .line 81
    :cond_0
    const/16 v3, 0xa

    invoke-virtual {v1, v3}, Ljava/util/Random;->nextInt(I)I

    move-result v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    .line 79
    add-int/lit8 v0, v0, 0x1

    goto :goto_0
.end method

.method public final getinstallId()Ljava/lang/String;
    .locals 1

    .prologue
    .line 67
    iget-object v0, p0, Lcom/trademob/tracking/TMInstallId;->myInstallId:Ljava/lang/String;

    return-object v0
.end method
